﻿@using Coralcode.Adapter.StatVisit.Entity.Domains
@using Coralcode.Adapter.StatVisit.Entity.Enums
@using Coralcode.Utils.Basic
@using CoralNode.MvcClient.Helper
@{
    ViewBag.Title = "来源分析-来源明细";
    ViewBag.PageModule = "source";
    ViewBag.CurrentPageUrl = "/m/statistic/sourcelog?charttype=" + ViewBag.dateselect + "&chartContent=" + ViewBag.chartContent + "&";
}
@Html.IncludePage("CoralAdmin/statistic", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        @Html.IncludePage("CoralAdmin/statistic", "DateSelection")
        <div class="main-box mt_2 mb_2">
            <div class="tab-visit clearfix">
                <a href="/m/statistic/source?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">来源分类统计</a>
                @*<a class="current" href="/m/statistic/sourcelog?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">来源明细</a>
                    <a href="/m/statistic/sourceengine?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">搜索引擎统计</a>*@
                <a href="/m/statistic/sourceenginekey?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">搜索词统计</a>
            </div>
            <div class="clearfix">
                <div class="table_visit">
                    <table width="100%" style="margin-top:2px;">
                        <thead>
                            <tr class="t_bg headRow">
                                <td width="20"></td>
                                <td>来源形式</td>
                                <td></td>
                                <td align="right">来访次数</td>
                                <td align="right">独立访客(UV)</td>
                                <td align="right">IP</td>
                                <td align="right">新独立访客</td>
                                <td align="right">站内浏览总次数</td>
                                <td align="right">跳出率</td>
                                <td width="20"></td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr class="count">
                                <td></td>
                                <td>全站统计</td>
                                <td></td>
                                <td align="right">@Model.SessionCount</td>
                                <td align="right">@Model.UniqueVisitor</td>
                                <td align="right">@Model.IpCount</td>
                                <td align="right">@Model.NewUniqueVisitor</td>
                                <td align="right">@Model.PageView</td>
                                <td align="right">@MathUtil.RoundPercent(Model.BounceRate)%</td>
                                <td></td>
                            </tr>
                            @foreach (StatReportDomain report in ViewBag.SourceSummaryReports)
                            {
                                <tr class="unfold_wrap">
                                    @if (report.StatKey == StatSourceTypeEnum.SearchEngine.ToString() || report.StatKey == StatSourceTypeEnum.NetworkExtension.ToString())
                                    {
                                        <td><div class="unfold"><i class="ico ico_up"></i></div></td>
                                    }
                                    else
                                    {
                                        <td></td>
                                    }
                                    <td><span class="color_green">@report.StatName</span></td>
                                    <td align="center"><a href="#"><i class="ico ico_visit_time"></i></a></td>
                                    <td align="right">@report.SessionCount</td>
                                    <td align="right">@report.UniqueVisitor</td>
                                    <td align="right">@report.IpCount</td>
                                    <td align="right">@report.NewUniqueVisitor</td>
                                    <td align="right">@report.PageView</td>
                                    <td align="right">@MathUtil.RoundPercent(report.BounceRate)%</td>
                                    <td></td>
                                </tr>
                                if (report.StatKey == StatSourceTypeEnum.SearchEngine.ToString())
                                {
                                    <tr class="unfold_cnt">
                                        <td colspan="10">
                                            <table width="100%">
                                                <tbody>
                                                    @if (ViewBag.SearchEngineSummaryReports == null || ViewBag.SearchEngineSummaryReports.Count == 0)
                                                    {
                                                        <tr>
                                                            <td width="50"></td>
                                                            <td style="padding: 9px 10px;">无数据</td>
                                                        </tr>
                                                    }
                                                    else
                                                    {
                                                        <tr>
                                                            <td width="20"></td>
                                                            <td colspan="9" style="padding: 9px 10px;">搜索引擎</td>
                                                        </tr>
                                                        foreach (StatReportDomain reportSearchEngine in ViewBag.SearchEngineSummaryReports)
                                                        {
                                                            <tr class="extraTrs">
                                                                <td style="padding: 9px 10px;" width="20"></td>
                                                                <td style="padding: 9px 10px;"><span class="color_green">@reportSearchEngine.StatName</span></td>
                                                                <td style="padding: 9px 10px;" align="center"><a href="#"><i class="ico ico_visit_time"></i></a></td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.SessionCount</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.UniqueVisitor</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.IpCount</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.NewUniqueVisitor</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.PageView</td>
                                                                <td style="padding: 9px 10px;" align="right">@MathUtil.RoundPercent(reportSearchEngine.BounceRate)%</td>
                                                                <td style="padding: 9px 10px;" width="20"></td>
                                                            </tr>
                                                        }
                                                        <tr>
                                                            <td width="20"></td>
                                                            <td colspan="9" style="padding: 9px 10px;">搜索词</td>
                                                        </tr>
                                                        foreach (StatReportDomain reportSearchKey in ViewBag.SearchKeySummaryReports)
                                                        {
                                                            <tr class="extraTrs">
                                                                <td style="padding: 9px 10px;" width="20"></td>
                                                                <td style="padding: 9px 10px;"><span class="color_green">@reportSearchKey.StatName</span></td>
                                                                <td style="padding: 9px 10px;" align="center"><a href="#"><i class="ico ico_visit_time"></i></a></td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchKey.SessionCount</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchKey.UniqueVisitor</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchKey.IpCount</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchKey.NewUniqueVisitor</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchKey.PageView</td>
                                                                <td style="padding: 9px 10px;" align="right">@MathUtil.RoundPercent(reportSearchKey.BounceRate)%</td>
                                                                <td style="padding: 9px 10px;" width="20"></td>
                                                            </tr>
                                                        }
                                                    }
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                }
                                if (report.StatKey == StatSourceTypeEnum.NetworkExtension.ToString())
                                {
                                    <tr class="unfold_cnt">
                                        <td colspan="10">
                                            <table width="100%">
                                                <tbody>
                                                    @if (ViewBag.NetworkExtensionSummaryReports == null || ViewBag.NetworkExtensionSummaryReports.Count == 0)
                                                    {
                                                        <tr>
                                                            <td width="50"></td>
                                                            <td style="padding: 9px 10px;">无数据</td>
                                                        </tr>
                                                    }
                                                    else
                                                    {
                                                        <tr>
                                                            <td width="20"></td>
                                                            <td colspan="9" style="padding: 9px 10px;">推广来源</td>
                                                        </tr>
                                                        foreach (StatReportDomain reportSearchEngine in ViewBag.NetworkExtensionSummaryReports)
                                                        {
                                                            <tr class="extraTrs">
                                                                <td style="padding: 9px 10px;" width="20"></td>
                                                                <td style="padding: 9px 10px;"><span class="color_green">@reportSearchEngine.StatName</span></td>
                                                                <td style="padding: 9px 10px;" align="center"><a href="#"><i class="ico ico_visit_time"></i></a></td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.SessionCount</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.UniqueVisitor</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.IpCount</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.NewUniqueVisitor</td>
                                                                <td style="padding: 9px 10px;" align="right">@reportSearchEngine.PageView</td>
                                                                <td style="padding: 9px 10px;" align="right">@MathUtil.RoundPercent(reportSearchEngine.BounceRate)%</td>
                                                                <td style="padding: 9px 10px;" width="20"></td>
                                                            </tr>
                                                        }
                                                    }
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                }
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $(".extraTrs").each(function () {
            $(this).find("td").each(function (i) {
                $(this).width($(".headRow td").eq(i).width());
            });
        });
    });
</script>